package com.example.mapper;

import com.example.pojo.Customer;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CustomerMapper {

    List<Customer> getCustomer(Customer customer);

    @Delete("delete from customer where cusCode=#{id}")
    void deleteCustomer(String id);

    @Update("UPDATE customer set cusName=#{cusName},cusPho=#{cusPho},cusAdd=#{cusAdd},cusPost=#{cusPost}," +
            "userName=#{userName},password=#{password} where cusCode=#{cusCode}")
    void updateCustomer(Customer customer);

    @Insert("INSERT INTO customer values (null,#{cusName},#{cusPho},#{cusAdd},#{cusPost},#{userName},#{password})")
    void addCustomer(Customer customer);

    @Select("select * from customer where userName=#{userName} and password=#{password}")
    Customer login(Customer customer);
    @Select("SELECT * from customer where cusCode=#{cusCode}")
    Customer getCustomerById(Integer cusCode);
}
